Jump to content

User:Omni Flames/closerm.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// closerm.js - written by [[User:Omni Flames]], modified from
// [[User:King of Hearts/closetfd.js]] by [[User:King of Hearts]
// [[Wikipedia:WikiProject User scripts/Scripts/CloseAFD.js]] by [[User:Johnleemk]]
// and [[User:Lifebaka/closedrv.js]] by [[User:Lifebaka]]

function autorm_result()
{
	var close = prompt("Result of debate?")
	var f = document.editform, t = f.wpTextbox1;
	t.value = t.value.split(']] ====').join(']] ====' + '\n' + '{{subst:' + 'RM top' + '|1=' + '\'' + '\'' + '\'' + close + '<small>([[Wikipedia:Requested moves/Closing instructions#Non-admin closure|non-admin closure]])</small>' '\'' + '\'' + '\'' + '.|2=y}}');
	t.value += "{{subst:" + "RM bottom" + "}}";
	f.wpSummary.value += "Closing debate; result was " + close;
}

function autorm_add_rm_tabs()
{
		mw.util.addPortletLink('p-cactions', 'javascript:autorm_result()', "close requested move");
	}
 
$(autorm_add_rm_tabs);